<?php
include_once("./c/config.php");
require_once "jssdk.php";
function https_request($url, $type="get", $res="json", $data = ''){
    //1.初始化curl
    $curl = curl_init();
    //2.设置curl的参数
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_SAFE_UPLOAD, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    if ($type == "post"){
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    }
    //3.采集
    $output = curl_exec($curl);
    //var_dump(curl_getinfo($curl));
    //4.关闭
    curl_close($curl);
    if ($res == 'json') {
        return json_decode($output,true);
    }
}

$openid='oy4Hbs1C528bfD3uwVXnLz5ZADO4';
 

$jssdk = new JSSDK($appId, $secret);
$acToken=$jssdk->getAccessToken();
$url='https://api.weixin.qq.com/card/user/getcardlist?access_token='.$acToken;

$data='{
  "openid": "'.$openid.'",
  "card_id": "'.$cardId.'"
}';
//echo $data;
echo "<br />";
$res = https_request( $url ,'post', 'json', $data);
 
var_dump($res);

    
     

